package com.fire.controller;


import com.fire.exception.ServiceException;
import com.fire.model.entity.Admin;
import com.fire.model.entity.Now;
import com.fire.response.ResultData;
import com.fire.service.IAdminService;
import com.fire.service.IAssessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.Map;

/**
 * <p>
 * 管理员表 前端控制器
 * </p>
 *
 * @author author
 * @since 2024-04-06
 */
@Slf4j
@Validated
@CrossOrigin
@RestController
@RequiredArgsConstructor
@Api(tags = {"预警评估模块"})
@RequestMapping("/assess")
public class AssessController {

    private final IAssessService assessService;

    /**
     * 查询监测警告地区的最新一条地区locationId
     * 然后返回这一个地区的未来一周的气温变化展示
     * @return
     */
    @GetMapping("/query")
    @ApiOperation(value = "查询预警评估数据(一周气温变化)")
    public ResultData queryAssessData(){
        Map<String,Object> map = assessService.queryAssessData();
        return ResultData.success(map);
    }

    /**
     * 查询监测警告地区的最新一条地区locationId
     * 然后返回这一个地区实时的空气质量指标
     * @return
     */
    @GetMapping("/query/air")
    @ApiOperation(value = "查询预警评估数据(空气质量指标)")
    public ResultData queryAirData(){
        Now now = assessService.queryAirData();
        return ResultData.success(now);
    }
}
